{
    let getItem = Storage.prototype.getItem,
        setItem = Storage.prototype.setItem;

    Storage.prototype.setItem = function (name, value) {
        if (value instanceof Object) {
            value = JSON.stringify(value)
        }
        setItem.apply(this, [name, value])
    }

    Storage.prototype.getItem = function (name) {
        let newValue = getItem.apply(this, [name])
        try {
            return JSON.parse(newValue)
        } catch (error) {
            return newValue
        }
    }

    Storage.prototype.proxy = function (name, init) {
        let value = this.getItem(name) || this.setItem(name, init || []) || []
        let _this = this
        const baseHandler = {
            get(target, key) {
                let value = Reflect.get(target, key)
                return typeof value === 'object' ? observed(value) : value
            },
            set(target, key, val) {
                Reflect.set(target, key, val)
                _this.setItem(name, value)
                _this.after()
                return target
            }
        };
        const observed = value => new Proxy(value, baseHandler);
        return observed(value)
    }

    Storage.prototype.query = function (name, value, fu) {
        let selector = name instanceof Object ? name : this.getItem(name)
        length = selector.length;
        if (selector instanceof Array) {
            let { key, val } = storageExp(value)
            for (let i = 0; i < length; i++) {
                if ('' + selector[i][key] === '' + val) {
                    return fu(i, selector) || i
                }
            }
        } else {
            throw new Error('value not a Object')
        }
    }

    function storageExp(srt) {
        let reg = /(?<key>[\s\S][^=]+)=(?<val>[\S\s]+)/,
            regAll = srt.match(reg);
        return { ...regAll.groups }
    }

    Storage.prototype.after = null

}